﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SalaLista.aspx.cs" Inherits="InfraWEB.UI.SalaLista" MasterPageFile="~/AdminMaster.Master" %>

<asp:Content runat="server" ContentPlaceHolderID="ContentPlaceHolder1">
		<div>
			<h1 class="style3">Lista de Salas</h1>
			<div class="error">
				<asp:Label runat="server" ID="lblMensagem" Visible="false"></asp:Label>
			    <br />
			</div>
			<div class="oneline">
				<asp:Button ID="btnNovaSala" Text="Nova Sala"  onclick="btnNovaSala_Click" runat="server"/>
			    <br />
                <br />
			</div>
			<asp:GridView ID="salaGridView" runat="server" AllowPaging="True" 
                AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" 
                DataKeyNames="SalId" DataSourceID="SqlDataSource1" ForeColor="#333333" 
                GridLines="None" onselectedindexchanged="salaGridView_SelectedIndexChanged">
                <RowStyle BackColor="#EFF3FB" />
                <Columns>
                    <asp:BoundField DataField="SalNome" HeaderText="Nome" 
                        SortExpression="SalNome" />
                    <asp:BoundField DataField="SalTipo" HeaderText="Tipo" 
                        SortExpression="SalTipo" />
                    <asp:BoundField DataField="PreId" HeaderText="Prédio" SortExpression="PreId" />
                    <asp:CommandField DeleteText="Apagar" EditText="Editar" ShowDeleteButton="True" 
                        ShowEditButton="True" />
                </Columns>
                <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                <EditRowStyle BackColor="#2461BF" />
                <AlternatingRowStyle BackColor="White" />
            </asp:GridView>
		    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                ConnectionString="<%$ ConnectionStrings:infraConnectionString %>" 
                DeleteCommand="DELETE FROM [Sala] WHERE [SalId] = @SalId" 
                InsertCommand="INSERT INTO [Sala] ([SalNome], [SalTipo], [PreId]) VALUES (@SalNome, @SalTipo, @PreId)" 
                SelectCommand="SELECT [SalNome], [SalTipo], [PreId], [SalId] FROM [Sala]" 
                UpdateCommand="UPDATE [Sala] SET [SalNome] = @SalNome, [SalTipo] = @SalTipo, [PreId] = @PreId WHERE [SalId] = @SalId">
                <DeleteParameters>
                    <asp:Parameter Name="SalId" Type="Int32" />
                </DeleteParameters>
                <UpdateParameters>
                    <asp:Parameter Name="SalNome" Type="String" />
                    <asp:Parameter Name="SalTipo" Type="Int32" />
                    <asp:Parameter Name="PreId" Type="Int32" />
                    <asp:Parameter Name="SalId" Type="Int32" />
                </UpdateParameters>
                <InsertParameters>
                    <asp:Parameter Name="SalNome" Type="String" />
                    <asp:Parameter Name="SalTipo" Type="Int32" />
                    <asp:Parameter Name="PreId" Type="Int32" />
                </InsertParameters>
            </asp:SqlDataSource>
		</div>
</asp:Content>
<asp:Content ID="Content1" runat="server" contentplaceholderid="head">

    <style type="text/css">
        .style3
        {
            color: #507CD1;
        }
    </style>

</asp:Content>

